//1475. 商品折扣后的最终价格


#include <vector>
using namespace std;

class Solution 
{
public:
    vector<int> finalPrices(vector<int>& prices) 
    {
        for(int i = 0; i < prices.size(); i++)
        {
            int j = 0;
            for(j = i + 1; j < prices.size(); j++)
            {
                if(prices[j] <= prices[i]) break;
            }
            if(j < prices.size())
                prices[i] = prices[i] - prices[j];
        }
        return prices;
    }
};